<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
      .box{
        width: 100px;
        height: 100px;
        background-color: bisque;
      }

      /* 入场动画 */
      .v-enter-from{
        opacity: 0;
      }
      .v-enter-active,
      .v-leave-active{
        transition: all 2s ease-in;
      }

      .v-enter-to{
        opacity: 1;
      }
      .v-leave-to{
        opacity: 0;
      }
    </style>
  </head>
  <body>
    <div id="app">
    </div>
    

    <script src="../js/vue.js"></script>

    <script>
      const app = Vue.createApp({
        data() {
          return {
            msg: "耶耶耶",
            flag: false
          }
        },
        template:`
            <div>
              <transition>
                <div class="box" v-show="flag">{{msg}}</div>   
                
              </transition>
              <button @click="flag = !flag">显示/隐藏</button>
            </div>
        `
      }).mount("#app");
    </script>
  </body>
</html>